﻿// Decompiled with JetBrains decompiler
// Type: System.Web.Razor.Editor.RazorEditorTrace
// Assembly: System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// MVID: 682513D6-F37E-48AC-9909-F3EE103CFF14
// Assembly location: D:\Project\Idea\无人机外网\uav\客户端工程\排查工具\bin\Release\System.Web.Razor.dll

using System.Diagnostics;
using System.Globalization;
using System.Web.Razor.Resources;

namespace System.Web.Razor.Editor
{
  internal static class RazorEditorTrace
  {
    private static bool? _enabled;

    private static bool IsEnabled()
    {
      if (!RazorEditorTrace._enabled.HasValue)
      {
        bool result;
        if (bool.TryParse(Environment.GetEnvironmentVariable("RAZOR_EDITOR_TRACE"), out result))
        {
          Trace.WriteLine(string.Format((IFormatProvider) CultureInfo.CurrentCulture, RazorResources.Trace_Startup, result ? (object) RazorResources.Trace_Enabled : (object) RazorResources.Trace_Disabled));
          RazorEditorTrace._enabled = new bool?(result);
        }
        else
          RazorEditorTrace._enabled = new bool?(false);
      }
      return RazorEditorTrace._enabled.Value;
    }

    [Conditional("EDITOR_TRACING")]
    public static void TraceLine(string format, params object[] args)
    {
      if (!RazorEditorTrace.IsEnabled())
        return;
      Trace.WriteLine(string.Format((IFormatProvider) CultureInfo.CurrentCulture, RazorResources.Trace_Format, (object) string.Format((IFormatProvider) CultureInfo.CurrentCulture, format, args)));
    }
  }
}
